import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import BookrackView from '../views/BookrackView.vue'
import MyView from '../views/MyView.vue'
import DetailsView from '../views/DetailsView.vue'
import LoginView from '../views/LoginView.vue'
import UpdateView from '../views/UpdateView.vue'
import SearchView from '../views/SearchView.vue'
import ReadHistoryView from '../views/ReadHistoryView.vue'
import PassageView from '../views/PassageView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/bookrack',
    name: 'bookrack',
    component: BookrackView
  },
  {
    path: '/my',
    name: 'my',
    component: MyView
  },
  {
    path: '/details',
    name: 'details',
    component: DetailsView
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView
  },
  {
    path: '/update',
    name: 'update',
    component: UpdateView
  },
  {
    path: '/search',
    name: 'search',
    component: SearchView
  },
  {
    path: '/history',
    name: 'history',
    component: ReadHistoryView
  },
  {
    path: '/passage',
    name: 'passage',
    component: PassageView
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior: function () {
    return { x: 0, y: 0 };
},
})

export default router
